package com.xebest.web.mapper.read;

import com.xebest.web.form.XeVenPurchForm;
import com.xebest.web.model.XeVenPurchOrderBillEntity;
import com.xebest.web.model.XeVenPurchOrderEntity;
import com.xebest.web.view.*;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface XeVenPurchOrderReadMapper {

    /**
     * 根据条件查询采购单
     *
     * @author 李书峰
     */
    List<XeVenPurchView> queryPurchByParm(XeVenPurchOrderEntity purch);

    /**
     * 查询采购单详情
     *
     * @author 李书峰
     */
    XeVenPurchView queryPurchDetail(Map<String, Object> map);

    /**
     * 查询采购单商品列表
     *
     * @author 李书峰
     */
    List<XeVenPurchProductView> queryPurchProductList(Map<String, Object> map);

    /**
     * 查询已到货商品列表
     *
     * @author 李书峰
     */
    List<XeVenPurchProductView> queryPurchArriveProductList(Map<String, Object> map);

    /**
     * 查询商品记录列表
     *
     * @author 李书峰
     */
    List<Map<String, Object>> queryAllProductList(Map<String, Object> map);

    /**
     * @author 李书峰
     */
    public BigDecimal queryWaitDealPurchOrderNum(Map<String, Object> map);

    /**
     * @author 李书峰
     */
    public BigDecimal queryMonthPurchAmount(Map<String, Object> map);

    /**
     * 查询采购单据
     *
     * @author 李书峰
     */
    List<XeVenPurchOrderBillView> queryPurchBills(XeVenPurchOrderBillEntity bill);

    List<XeVenSumPurchView> querySummaryPurch(XeVenPurchForm form);

    List<XeVenSummaryPurchView> queryPurchDetailByParam(XeVenSumPurchView xeVenSumPurchView);

    int querySendOrderNums(Map<String, Object> resultMap);

    List<XeVenPurchView> queryPurchByParmRestApi(XeVenPurchOrderEntity purchEntity);

    XeVenPurchView queryPurchDetailRestApi(Map<String, Object> map);

    /**
     * 采购订单中某商品被占用数量
     *
     * @param spu 商品的spu
     * @return spu在采购单中呗占用的采购单数
     * @author zhouys
     */
    int spuTakeUpCount(@Param("spu") String spu);
}